<%@page import="java.util.Vector"%>
<%@page import="board.ComenVo"%>
<%@page import="board.BoardVo"%>
<%@page import="board.Board"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<link rel="stylesheet" type="text/css" href='./board/board.css'>
<script src='./board/board.js'></script>

</head>
<body>
<jsp:useBean id="boardVo" class="board.BoardVo"/>
<jsp:setProperty property="*" name="boardVo"/>
<jsp:useBean id="comenVo" class="board.ComenVo"/>
<jsp:setProperty property="*" name="comenVo"/>

<%
Board board = new Board();
board.setVo(boardVo);
BoardVo bv = board.view();

//다운로드받기위해
String url = "upload/" + bv.getFilename();
String mid = (String)session.getAttribute("mid");
String part = (String)session.getAttribute("part");
if(mid==null) mid="disconn";
if("익명게시판".equals(part)) mid = "익명";
%>
<!-- title -->
<div id='bb_title'><%=part%> - 상세화면</div><br/>
<!-- end title -->
<div id='brd_out'>


<div id='brd_line'>
	<div id='brd_left'>작성자</div>
	<div id='brd_right'><%=bv.getMid()%></div>
</div>
<hr noshade size="0.000001" color="#cccccc"/>
<div id='brd_line'>
	<div id='brd_left'>작성일</div>
	<div id='brd_right'><%=bv.getMdate()%></div>
</div>
<hr noshade size="0.000001" color="#cccccc"/>
<div id='brd_line'>
	<div id='brd_left'>제목</div>
	<div id='brd_right'><%=bv.getSubject()%></div>
</div>
<hr noshade size="0.000001" color="#cccccc"/>
<div id='brd_line'>
	<div id='brd_left'>등록파일</div>
	<div id='brd_right'>
	
	<%if(!bv.getFilename().equals("NoFile")) {%>
			<a href="#" onclick="fileDownLoad('<%=bv.getFilename()%>')">
				<%=bv.getFilename()%>
			</a>
			<%}else{ %>
				<%=bv.getFilename()%>
			<%} %>
	</div>
</div>
<hr noshade size="0.000001" color="#cccccc"/>
<div id='brd_line2'>
		<textarea rows="12" cols="100" readonly><%=bv.getContent()%></textarea>
</div>
<hr noshade size="0.000001" color="#cccccc"/>
<div id='brd_line'>
	<%if(mid.equals(bv.getMid())){ %>
	<input type='button' value='수정' onclick="brd_mod(<%=bv.getSerial()%>)">
	<input type='button' value='삭제' onclick="brd_del(<%=bv.getSerial()%>,<%=bv.getPwd()%>,'<%=bv.getFilename()%>')">
	<%} 
	if(!mid.equals("disconn")){%>
	<input type='button' value='리플' onclick="brd_rep(<%=bv.getSerial()%>,<%=bv.getGrp()%>,'<%=bv.getDeep()%>')">
	<%} %>
	<input type='button' value='목록' id="brd_btnList">
</div>
<hr noshade size="0.000001" color="#cccccc"/>


<div id='brd_out'>
<%
//댓글 입력
if(!mid.equals("disconn")){
%>
	<form id='brd_line' name='frm_comment' method="post" action="">
	<input type="hidden" name="serial" value="<%=bv.getSerial()%>">
	<div id='brd_left'><%=mid%></div>
 	<input type="hidden" name="mid" value="<%=mid%>">
	<div id='brd_right'>
		<input style="width: 450px;"type="text" name='content'>
		<input type="button" value="입력" id='brd_btnComment'>
	</div>
	</form>
	<hr/>
<%}else{
	out.print("<B>로그인을 하셔야 댓글을 작성 하실수 있습니다.</B>");
}
	
//댓글 출력
Board bo = new Board();
bo.setCvo(comenVo);
Vector<ComenVo> v = bo.comment();
%>
		<div id='brd_line' style="background-color:#0fce84; color: #ffffff; 
	font-size:25px;">
			<div id='brd_left'>작성자</div>
			<div id='brd_right'>
				<div id='co_content'>댓글 내용</div>
				<div id='co_mdate'>게시 날짜</div>
			</div>
		</div>
		<hr />
		<%
			for(int i=0; i<v.size(); i++){
				ComenVo cv = v.get(i);
		%>
		<div id='brd_line'>
			<div id='brd_left'><%=cv.getMid()%></div>
			<div id='brd_right'>
				<div id='co_content'><%=cv.getContent()%></div>
				<div id='co_mdate'><%=cv.getMdate()%></div>
			</div>
		</div>
		<%}	%>
		
		
</div>

</div>
</body>
</html>